Public Partial Class FrmListadoDetalleFacturaVenta
    Inherits System.Web.UI.Page
    Public DetalleFactura As CapaDeNegocios.nDetalleFacturaVenta = New CapaDeNegocios.nDetalleFacturaVenta
    Dim IdFactura As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("Login") = "Anonimo" Then
            Response.Redirect("/")
        End If

        If Not Page.IsPostBack Then
            IdFactura = Request.QueryString("IDFactura")
            HFIdFactura.Value = IdFactura
            '            IdFactura = 4
            If IdFactura <> "" Then
                LlenarCuerpo()
            End If
        End If
    End Sub
    Sub LlenarCuerpo()
        GridDetalle.DataSource = DetalleFactura.BuscarFiltrado("", "", "", "", HFIdFactura.Value.ToString(), "", "")
        GridDetalle.DataBind()
    End Sub

    Protected Sub GridDetalle_RowDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridDetalle.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim a As LinkButton = e.Row.FindControl("LnkSeleccion")
            Dim b As HiddenField = e.Row.FindControl("HFIdRemito")
            If b.Value <> "" Then
                a.OnClientClick = "javascript:var popup = window.open('FrmListarDetalleRemitoServicio.aspx?IDRemito=" + b.Value.ToString() + "',(new Date().getTime()),'Width=700,Height=500,Scrollbars=NO,Resizable=NO,Location=NO,Menubar=NO,Status=NO,Titlebar=NO,Toolbar=NO')"
            Else
                a.Visible = False
            End If
        End If

    End Sub

    Protected Sub GridDetalle_PageIndexChanging(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridDetalle.PageIndexChanging
        GridDetalle.PageIndex = e.NewPageIndex
        LlenarCuerpo()
    End Sub
End Class